package com.xyp.sso.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class SSOCompany implements Serializable {

    /** 
     * @Fields serialVersionUID : 
     */
    private static final long serialVersionUID = -1087633411617240254L;

    private String companyName;

    private int id;

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public SSOCompany(String companyName, int id) {
        super();
        this.companyName = companyName;
        this.id = id;
    }

    public SSOCompany() {
        super();
    }

    @Override
    public String toString() {
        return "SSOCompany [companyName=" + companyName + ", id=" + id + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((companyName == null) ? 0 : companyName.hashCode());
        result = prime * result + id;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof SSOCompany)) {
            return false;
        }
        SSOCompany other = (SSOCompany) obj;
        if (companyName == null) {
            if (other.companyName != null) {
                return false;
            }
        } else if (!companyName.equals(other.companyName)) {
            return false;
        }
        if (id != other.id) {
            return false;
        }
        return true;
    }

    public SSOCompany getDefaultCompany() {

        this.companyName = "bat";
        this.id = 100;
        return this;

    }

    public static List<SSOCompany> getDefaultCompanyList(int num) {

        List<SSOCompany> defaultList = new ArrayList<>(num);
        for (int i = 0; i < num; i++) {
            defaultList.add(new SSOCompany("bat" + i, i));
        }

        return defaultList;

    }

}
